# Copyright 2024-2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")

# Contains Skia rendering utilities that are specific to the Skia C++ renderer.
package(
    default_visibility = ["//ink:__subpackages__"],
)

cc_library(
    name = "skia_renderer",
    srcs = ["skia_renderer.cc"],
    hdrs = ["skia_renderer.h"],
    visibility = [
        "//visibility:public",
    ],
    deps = [
        ":texture_bitmap_store",
        "//ink/brush",
        "//ink/brush:brush_coat",
        "//ink/brush:brush_paint",
        "//ink/brush:brush_tip",
        "//ink/color",
        "//ink/geometry:affine_transform",
        "//ink/geometry:mesh",
        "//ink/geometry:mesh_format",
        "//ink/geometry:mesh_packing_types",
        "//ink/geometry:mutable_mesh",
        "//ink/geometry:partitioned_mesh",
        "//ink/geometry:rect",
        "//ink/rendering/skia/native/internal:mesh_drawable",
        "//ink/rendering/skia/native/internal:mesh_specification_cache",
        "//ink/rendering/skia/native/internal:mesh_uniform_data",
        "//ink/rendering/skia/native/internal:path_drawable",
        "//ink/rendering/skia/native/internal:shader_cache",
        "//ink/strokes:in_progress_stroke",
        "//ink/strokes:stroke",
        "//ink/strokes/input:stroke_input_batch",
        "@com_google_absl//absl/base:nullability",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/container:inlined_vector",
        "@com_google_absl//absl/functional:overload",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/types:span",
        "@skia//:core",
        "@skia//:ganesh_gl",
    ],
)

cc_test(
    name = "skia_renderer_test",
    srcs = ["skia_renderer_test.cc"],
    deps = [
        ":skia_renderer",
        "//ink/color",
        "//ink/geometry:affine_transform",
        "//ink/geometry:angle",
        "//ink/geometry:type_matchers",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "texture_bitmap_store",
    hdrs = ["texture_bitmap_store.h"],
    deps = [
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings:string_view",
        "@skia//:core",
    ],
)
